package com.xxx.car.service.impl;

import com.xxx.car.entity.vo.response.RespDict;
import com.xxx.car.mapper.TbDictMapper;
import com.xxx.car.service.DictService;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.stream.Collectors;

/**
 * Created by xuwenjie on 2017/6/22.
 */
@Service
public class DictServiceImpl implements DictService {

    @Autowired
    private TbDictMapper tbDictMapper;

    public List<RespDict> findByGroup(String group) {

        return tbDictMapper.selectByGroup(group).stream().map(e -> {
            RespDict respDict = new RespDict();
            BeanUtils.copyProperties(e, respDict);
            return respDict;
        }).collect(Collectors.toList());

    }

}
